package com.jyy.prefabricated.dto;

import com.jyy.prefabricated.entity.OfflineOrder;
import com.jyy.prefabricated.entity.StudentSignUpApply;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

@Data
public class PayOrderDto {
    @NotNull(message = "projectId不能为空")
    private Integer projectId;
    private Integer status;
    private String payOrder;
    private Integer payType;
    /**
     * 机构id(购买人id)
     */
    private Integer trainingOrganizationId;
    /**
     * 订单类型
     */
    private Integer orderType;

    private List<Integer> ids;

    /**
     * 订单总价
     */
    private BigDecimal totalPrice;

    public StudentSignUpApply toStudentSignUpApply() {
        StudentSignUpApply studentSignUpApply = new StudentSignUpApply();
        studentSignUpApply.setPayOrder(payOrder);
        studentSignUpApply.setProjectId(projectId);
        studentSignUpApply.setTrainingOrganizationId(trainingOrganizationId);

        return studentSignUpApply;
    }

    public OfflineOrder toOfflineOrder() {
        OfflineOrder offlineOrder = new OfflineOrder();
        offlineOrder.setPayOrder(payOrder);
        offlineOrder.setGoodsId(projectId.longValue());
        offlineOrder.setUser(trainingOrganizationId.longValue());
        offlineOrder.setTotalPrice(totalPrice);
        offlineOrder.setOrderType(orderType);
        return offlineOrder;
    }


}
